﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KvoMvc.BusinessEntity;
using KvoMvc.ServiceProxy;

namespace KvoMvc.WebUI.Controllers
{
    public class PersonController : Controller
    {
        //
        // GET: /Person/
        public ActionResult Index()
        {
            var personList = SchoolManagerProxy.GetPersonList();
            return View(personList);
        }

        //
        // GET: /Person/Browse
        //public string Browse(string name)
        //{
        //    //using the HttpUtility.HtmlEncode utility method to sanitize the user input. 
        //    //This prevents users from injecting Javascript into our View with a link like /Store/Browse?Genre=<script>window.location=’http://hackersite.com’</script>.
        //    string message = HttpUtility.HtmlEncode("Person.Name = " + name);
            
        //    return message;
        //}


        // GET: /Person/Browse
        public ActionResult Browse(Person person)
        {
            //using the HttpUtility.HtmlEncode utility method to sanitize the user input. 
            //This prevents users from injecting Javascript into our View with a link like /Store/Browse?Genre=<script>window.location=’http://hackersite.com’</script>.
            

            return View(person);
        }

        //
        // GET: /Person/Details
        public string Details(int id)
        {
            

            //Run the application and browse to /Person/Details/5
            string message = string.Format("Person.Details, Id = {0}", id.ToString());
            return message;
        }


    }
}
